<{include file="_head.html"}>

<{include file="head.html"}>
<script type="text/javascript" src="js/jquery.qqFace.js"></script> 
<script type="text/javascript">
$(function(){
	//点赞
	$(".a_zx_tb1").click(function(){
		var info_id=$(this).attr("info_id");
	
			$.post(
		        'ajax.php?action=addZan',
		        {info_id:info_id},
		        function(data){
		          if(data.res==1){
		            alert(data.mes);
		          }else{
		            alert("请先登录！");
		            window.location.href="login.php";
		          }
		    },"json")
	})

	//取消点赞
	$(".a_zx_tb2").click(function(){
		// var uid = getCookie('user_id');
		var info_id=$(this).attr("info_id");
			$.post(
		        'ajax.php?action=cutZan',
		        {info_id:info_id},
		        function(data){
		          if(data.res==1){
		            alert(data.mes);
		          }else{
		            alert("请先登录！");
		            window.location.href="login.php";
		          }
		    },"json")
	})

})	
</script>
<script type="text/javascript">
$(function(){
    //匹配表情-初始化
    $('.neirong').each(function(){
        var text=$(this).html();
        $(this).html(replace_em(text));
    })

    //显示对应评论(小编说的评论)
    $(".look_pl").click(function(){
        var sort=$(this).attr("sort");//排序
        $(".index_hf").hide();
        $(".index_hf").eq(sort).show();
        // $(".index_hf").show();
    })
    //显示回复框(回复小编说)
    $(".hf").click(function(){
        var sort=$(this).attr("sort");//排序
        $(".jsy_hfk").hide();
        $(".jsy_hfk").eq(sort).show();
        //重置样式+默认设置
        $(".hfr").eq(sort).hide();
        $(".reply_id").val('0');
        $(".user_type").val('admin');

    })

    //点击单独回复
    $(".dan_hf").live('click',function(){
        var sort=$(this).parent().parent().attr("sort");//排序
        var name=$(this).attr("name");//回复名称
        var reply_id=$(this).attr("reply_id"); //需回复ID
        var user_type=$(this).attr("user_type");//被回复人类型

        $(".jsy_hfk").hide();           //评论框
        $(".jsy_hfk").eq(sort).show();  //评论框
        //回复人信息
        $(".hfr").eq(sort).show();
        $(".hfr").eq(sort).html('in reply to '+name); //展示
        $(".reply_id").val(reply_id);                 //被回复人
        $(".user_type").val(user_type);               //回复的类型 

    })


    //提交评论
   $(".tj").click(function(){
        var id=$(this).attr("id");                    //小编说编号       
        var sort=$(this).attr("sort");                //排序
        var comment=$(".jsy_hfk1").eq(sort).val();    //评论内容
        var reply_id=$(".reply_id").val();            //需回复ID
        var user_type=$(".user_type").val();          //回复的类型

        $.post(
            'info_list.php?action=comment',
            {id:id,comment:comment,reply_id:reply_id,user_type:user_type},
            function(data){
              if(data.error==1){
                 alert(data.mes);
                 //写入样式
                 $(".index_hf").eq(sort).prepend(data.html);
                 //显示评论列表
                 $(".index_hf").eq(sort).show();
                 //替换表情
                 var text=$(".index_hf").eq(sort).children(".tctk_2").children("p").find(".neirong").eq(0).html();

                 $(".index_hf").eq(sort).children(".tctk_2").children("p").find(".neirong").eq(0).html(replace_em(text));

                 //重置样式
                 $(".hfr").eq(sort).hide();     //回复展示信息
                 $(".reply_id").val('0');       //回复人
                 $(".user_type").val('admin');  //回复类型
                 $(".jsy_hfk1").eq(sort).val(''); //回复内容 
              }else{
                alert("请先登录！");
                window.location.href="login.php";
              }
        },"json")
   })

    //表情特效
    for (var i = 0; i < '<{$commentNum}>'; i++) {
        $('.emotion'+i).qqFace({ // 
          id : 'facebox'+i, //表情盒子的ID
          assign:'saytext'+i, //给那个控件赋值
          path:'images/face/' //表情存放的路径，注意如果修改了这个地方，下面正则匹配的地方也要做相应的修改
        });
    };

}) 

   //表情替换
    function replace_em(str){
        str = str.replace(/\</g,'&lt;');
        str = str.replace(/\>/g,'&gt;');
        str = str.replace(/\n/g,'<br/>');
        str = str.replace(/\[em_([0-9]*)\]/g,'<img src="images/face/$1.gif" border="0" />');
        return str;
    }
</script>


<div class="main">
<!-- left -->
<div class="main_left">
<div class="main_left_top">
	<{if $search.title==''&&$search.label_id==''}>
	<!-- <ul class="ul_main_left_top group" >
		<li><a <{if $smarty.get.class_id==''}> class="active" style="color:#FFFFFF"<{/if}> href="info_list.php">全部</a></li>
		<{foreach item=loop from=$info_class}>
		<li><a <{if $smarty.get.class_id==$loop.id}> class="active" style="color:#FFFFFF"<{/if}> href="info_list.php?class_id=<{$loop.id}>"><{$loop.class_name}></a></li> 
		<{/foreach}>
	</ul> -->
	<script type="text/javascript" src="js/example.js"></script>
	<div class="nav-wrap">
        <ul class="group" id="example-one">
          <li <{if $smarty.get.class_id==''}> class="current_page_item" <{/if}>><a  href="info_list.php">全部</a></li>
		<{foreach item=loop from=$info_class}>
		  <li <{if $smarty.get.class_id==$loop.id}> class="current_page_item" <{/if}> ><a  href="info_list.php?class_id=<{$loop.id}>"><{$loop.class_name}></a></li> 
		<{/foreach}>
        </ul>
    </div>
	<{elseif $search.title!=''}>		
		<span class="span_weizhi">首页  >  搜索 > <{$search.title}>   相关信息</span>
	<{else}>
		<span class="span_weizhi">首页  >  标签 > <{$search.label}>   相关信息</span>
	<{/if}>
</div>
<div class="clear"></div>
<div class="main_left_nr">
<!-- 1 -->
<{foreach item=loop from=$row.one}>
<div class="main_left_1">
<div class="main_left_1_img">
<{if $loop.type=='admin'}>
<img src="images/xbs_tb.png" width="55" height="51" class="xbs_tb" />
<{/if}>
<a href="info_detail.php?id=<{$loop.id}>"><img src="./upload/info/small/<{$loop.thumbnail}>" width="255" height="167" /></a>
</div>
<div class="main_left_1_right">
<a href="info_detail.php?id=<{$loop.id}>" class="a_main_left_1_right"><{$loop.title}></a>
<p><{$loop.intro|truncate:120}></p>
<a href="info_detail.php?id=<{$loop.id}>" class="a_more">more&gt;&gt;</a>
<div class="clear"></div>
<div class="main_left_1_btm">
<span class="span_main_left_1_btm"><{$loop.className}></span>
<ul class="ul_zx_tb">
<li><span><{$loop.click_num}>人</span></li>
<li><a href="javascript:;" class="a_zx_tb1" info_id="<{$loop.id}>"></a></li>
<li><a href="javascript:;" class="a_zx_tb2" info_id="<{$loop.id}>"></a></li>
<li><a href="javascript:;" class="a_zx_tb3"></a></li>
</ul>
</div>
</div>
</div>
<{/foreach}>
<!-- 1 -->
<{if $nowNum>0}>
<div class="clear"></div>
<div class="rq_line"><span><{$now_time}></span></div>
<{/if}>
<!-- 1 -->
<{foreach item=loop from=$row.two}>
<div class="main_left_1">
<div class="main_left_1_img">
<{if $loop.type=='admin'}>
<img src="images/xbs_tb.png" width="55" height="51" class="xbs_tb" />
<{/if}>
<a href="info_detail.php?id=<{$loop.id}>"><img src="upload/info/small/<{$loop.thumbnail}>" width="255" height="167" /></a>
</div>
<div class="main_left_1_right">
<a href="info_detail.php?id=<{$loop.id}>" class="a_main_left_1_right"><{$loop.title}></a>
<p><{$loop.intro|truncate:120}></p>
<a href="info_detail.php?id=<{$loop.id}>" class="a_more">more&gt;&gt;</a>
<div class="clear"></div>
<div class="main_left_1_btm">
<span class="span_main_left_1_btm"><{$loop.className}></span>
<ul class="ul_zx_tb">
<li><span><{$loop.click_num}>人</span></li>
<li><a href="javascript:;" class="a_zx_tb1" info_id="<{$loop.id}>"></a></li>
<li><a href="javascript:;" class="a_zx_tb2" info_id="<{$loop.id}>"></a></li>
<li><a href="javascript:;" class="a_zx_tb3"></a></li>
</ul>
</div>
</div>
</div>
<{/foreach}>
<!-- 1 -->
<!-- 1 -->
<div class="clear"></div>
<div class="page">
<ul class="ul_page">
	<!-- <li><a href="#">上一页</a></li>
	<li><a href="#">1</a></li>
	<li><a href="#">2</a></li>
	<li><a href="#">下一页</a></li> -->
	<{$page}>
</ul>

</div>

</div>
</div>
<!-- left -->
<!-- right -->
<div class="main_right">
<span class="span_bq">标签</span>
<div class="biaoqian">
<!-- <a href="#" class="a1_bq">创业</a>
<a href="#" class="a2_bq">智能硬件</a>
<a href="#" class="a3_bq">医疗</a>
<a href="#" class="a4_bq">生活</a>
<a href="#" class="a5_bq">在线教育</a> -->
<a href="info_list.php?label_id=<{$label_class.0.id}>" class="a1_bq"><{$label_class.0.label_name}></a>
<a href="info_list.php?label_id=<{$label_class.1.id}>" class="a2_bq"><{$label_class.1.label_name}></a>
<a href="info_list.php?label_id=<{$label_class.2.id}>" class="a3_bq"><{$label_class.2.label_name}></a>
<a href="info_list.php?label_id=<{$label_class.3.id}>" class="a4_bq"><{$label_class.3.label_name}></a>
<a href="info_list.php?label_id=<{$label_class.4.id}>" class="a5_bq"><{$label_class.4.label_name}></a>
</div>


   <span class="span_bq">吐槽调侃</span>
	 <input type="hidden" class="reply_id" value="0"/>
     <input type='hidden' name='user_type' class="user_type" value="admin" />

   <{foreach item=loop key=key from=$comment}>
 	<div class="tctk_1"> <a href="javascript:;" class="a_tctk"><{$loop.topic}></a> 
 		<span class="span_hfpl">
 		<a href="javascript:;" class="hf" sort="<{$key}>">回复</a>
 		<a href="javascript:;" class="look_pl" sort="<{$key}>">查看评论</a></span> 
 	</div>

 	<div class="index_hf" style="display:none;" sort="<{$key}>">
 	<{foreach item=reply from=$loop.reply}>
	 	<div class="tctk_2">
	      <p><a href="user_main.php?type=<{$reply.type}>&id=<{$reply.user_id}>"><{$reply.userName}></a>：<{if $reply.reply_id>0}>回复&nbsp;@<a href="user_main.php?type=<{$reply.reply_type}>&id=<{$reply.reply_id}>"><{$reply.replyName}></a>：<{/if}>
	      <span class="neirong"><{$reply.comment}></span></p>
	    </div>
	    <span class="span_hfpl_2"><a href="javascript:;" class="dan_hf" name="<{$reply.userName}>" reply_id="<{$reply.user_id}>" user_type="<{$reply.type}>">回复</a></span>
	    <!-- <span> -->
    <{/foreach}>
    <a href="topic_list.php?id=<{$loop.id}>" >查看更多>></a>
    </div>

    <span class="j_tctky2">
    <span class="jsy_hfk" style="display:none;">
        <span class="hfr" style="display:none;"></span>
        <a href="javascript:;" class="emotion<{$key}>">表情</a>
    	<textarea name="comment" cols="" rows="" class="jsy_hfk1 " id="saytext<{$key}>"></textarea>
        <span class="jsy_hfk2"><a href="javascript:;" id="<{$loop.id}>" class="tj" sort="<{$key}>">提交</a></span>
    </span>
   </span>
<{/foreach}>
    
   
<!-- <{foreach item=loop from=$comment}>
<div class="tctk_1">
<a href="#" class="a_tctk"><{$loop.topic}></a>
<span class="span_hfpl"><a href="#">回复</a><a href="#">查看评论</a></span>
</div>
<{foreach item=reply from=$loop.reply}>
<div class="tctk_2">
<p><{if $reply.type=='admin'}>小编：<{else if $reply.type=='user'}>用户：<{/if}><{$reply.comment}></p>
</div>
<span class="span_hfpl_2"><a href="#">回复</a></span>
<{/foreach}>

<{/foreach}> -->




<div class="page_right">
<ul class="ul_page_right">
<!-- <li><a href="#">上一页</a></li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">下一页</a></li> -->
<a href="topic_list.php">查看更多&gt;&gt;</a>
</ul>
</div>

<a href="info_apply.php" class="a_wztg">文章投稿&gt;&gt;</a>

</div>
<!-- right -->
</div>
<{include file="footer.html"}>
